package prolog.fluents

import prolog.terms.Const
import prolog.terms.Prog
import prolog.terms.Sink
import prolog.terms.Term

/**
  Builds  Fluents from Scala
  Streams
*/


class StringSink extends Sink{
		protected StringBuffer buffer;
		
		public StringSink(Prog p){
			super(p)
			this.buffer=new StringBuffer()
			}
		def putElement(Term t):int={
			buffer.append(t.toUquoted())
			1
			}

		def stop():Unit={
			buffer=null
				}
		def collect():Term{
			return new Const(buffer.toString())
				}
}